import Vue from 'vue'

// 项目样式进行初始化
import 'normalize.css/normalize.css' // A modern alternative to CSS resets

// 导入Element
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // 全局样式

import App from './App' // 导入项目根组件
import store from './store' // 引入 Vuex
import router from './router' // 引入 路由

import '@/icons' // 字体图标
import '@/permission' // 权限控制的(导航守卫/路由守卫)

// 导入自定义组件
// import PageTools from '@/components/PageTools'
// 注册全局组件
// Vue.component('PageTools', PageTools)

// Vue.directive('power', {
//   inserted: (el, binding) => {
//     const points = store.state.user.userInfo.roles.points
//     if (!points.includes(binding.value)) {
//       el.parentNode.removeChild(el)
//     }
//   }
// })

// 将全局的指令抽取成公共的模块
import directive from '@/directive'
Vue.use(directive)
// 将全局的组件抽取成公共的模块
import component from '@/components'
Vue.use(component)
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */

// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.config.productionTip = false

// 对Vue进行实例化
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
